<html>
 <head>
  <link href="./leetcode-problem.css" rel="stylesheet" type="text/css">
 </head>
 <body>
  <div class="question_difficulty">
   难度：Easy
  </div>
  <div>
   <h1 class="question_title">
    476. Number Complement
   </h1>
   <p>
    Given a positive integer, output its complement number. The complement strategy is to flip the bits of its binary representation.
   </p>
   <p>
    <b>
     Note:
    </b>
    <br>
   </p>
   <ol>
    <li>
     The given integer is guaranteed to fit within the range of a 32-bit signed integer.
    </li>
    <li>
     You could assume no leading zero bit in the integer&rsquo;s binary representation.
    </li>
   </ol>
   <p>
    <b>
     Example 1:
    </b>
    <br>
   </p>
   <pre>
<b>Input:</b> 5
<b>Output:</b> 2
<b>Explanation:</b> The binary representation of 5 is 101 (no leading zero bits), and its complement is 010. So you need to output 2.
</pre>
   <p>
    <b>
     Example 2:
    </b>
    <br>
   </p>
   <pre>
<b>Input:</b> 1
<b>Output:</b> 0
<b>Explanation:</b> The binary representation of 1 is 1 (no leading zero bits), and its complement is 0. So you need to output 0.
</pre>
  </div>
  <div>
   <h1 class="question_title">
    476. 数字的补数
   </h1>
   <p>
    给定一个正整数，输出它的补数。补数是对该数的二进制表示取反。
   </p>
   <p>
    <strong>
     注意:
    </strong>
   </p>
   <ol>
    <li>
     给定的整数保证在32位带符号整数的范围内。
    </li>
    <li>
     你可以假定二进制数不包含前导零位。
    </li>
   </ol>
   <p>
    <strong>
     示例 1:
    </strong>
   </p>
   <pre>
<strong>输入:</strong> 5
<strong>输出:</strong> 2
<strong>解释:</strong> 5的二进制表示为101（没有前导零位），其补数为010。所以你需要输出2。
</pre>
   <p>
    <strong>
     示例 2:
    </strong>
   </p>
   <pre>
<strong>输入:</strong> 1
<strong>输出:</strong> 0
<strong>解释:</strong> 1的二进制表示为1（没有前导零位），其补数为0。所以你需要输出0。
</pre>
  </div>
 </body>
</html>